UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wUw7g12lcrCP1Io2wJuTIqngJnqPLgSDM40vDQCWCU8='
WHERE
key_id = '7dde7632835c13604482492c55107d72ee18c0a2f6405c0ef82eb4b15042c6c5'
AND (
token = 'wUw7g12lcrCP1Io2wJuTIqngJnqPLgSDM40vDQCWCU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)