UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd7GuJUlq+6uS0fl0b2A4hZamPVXdIypKlfWqpTPYkFw='
WHERE
key_id = '1efa89d853658c223bf13ca2917e640e3fd02a5fb8ef0140edac0444bd9ee0d8'
AND (
token = 'd7GuJUlq+6uS0fl0b2A4hZamPVXdIypKlfWqpTPYkFw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)