UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1O9nDXezxKMn9sprJSQ+CrooqDkF4Jvz9TE3+2OfP14='
WHERE
key_id = 'd0715e19a37326b4ef8b7a1ec210883d6641d595b3a74e736904a6a5f4baf767'
AND (
token = '1O9nDXezxKMn9sprJSQ+CrooqDkF4Jvz9TE3+2OfP14='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)