UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6n1ul3BfD7tQ9Cy5cBup+/V4jHXmg4flhznkOcGVCEE='
WHERE
key_id = 'a4e8320f872196088f1ae15d091ea7cedbc5ead690555b0477555b1bb502245c'
AND (
token = '6n1ul3BfD7tQ9Cy5cBup+/V4jHXmg4flhznkOcGVCEE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)