UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '40t+vX3nuavpcMrLI8gO2hP4gIgeAVDBNzjlNoOB4Ws='
WHERE
key_id = '8946ae0a5d775e189c5e7e226fa5d332fb404e85b89f9641b8625f0ce08a6bfe'
AND (
token = '40t+vX3nuavpcMrLI8gO2hP4gIgeAVDBNzjlNoOB4Ws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)