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