UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N/pI8JqI/nTAkll+2Jf7sfALpRbzfANNub4JC7sL//Y='
WHERE
key_id = 'd8a516556ee2ba791ec051690b4f3718ea9a8806eb0db521b5f73a2aa423568a'
AND (
token = 'N/pI8JqI/nTAkll+2Jf7sfALpRbzfANNub4JC7sL//Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)