UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mDztayuqeXfT5JWgI0zfynIj9IGaUdHldodxMUrpVY4='
WHERE
key_id = '37e3cec1c285213e339a7f5019e8fa994d253536008035436578adcf410597ed'
AND (
token = 'mDztayuqeXfT5JWgI0zfynIj9IGaUdHldodxMUrpVY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)