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