UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M+usX7NcRm1f1p7FZpQQ3vzCqoc3vPmlVpjPyPid2nU='
WHERE
key_id = 'c3a35ccc925a21b829e35f40f99a8fe73817182333dc924b4e6078e65cecb7a7'
AND (
token = 'M+usX7NcRm1f1p7FZpQQ3vzCqoc3vPmlVpjPyPid2nU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)