UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xRCnjAivzNt5w075Zc2VS9kh89xVJjxGFGxQl0ACmBQ='
WHERE
key_id = 'ef8ce840a82bca3bdf072a9899b0da5b878591d1d05d013906d317cf11cae612'
AND (
token = 'xRCnjAivzNt5w075Zc2VS9kh89xVJjxGFGxQl0ACmBQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)