UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0fOI6mxLelyTQxMgjvimAqRWi3GvoGEC+yqpB01jzjI='
WHERE
key_id = '9343e8edd09fb1f0b2bd4bb53799b151d58dda457ba2a7ff137bffaf1b1cc95b'
AND (
token = '0fOI6mxLelyTQxMgjvimAqRWi3GvoGEC+yqpB01jzjI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)