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