UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dEotl5xFvrt+Ry4idlEjLCSqzylN/3B8aLZNqzi1jxc='
WHERE
key_id = 'c13667882a4f5eabdd1dfb152a727733bfd73b5ac15d9448727ab92950869ad7'
AND (
token = 'dEotl5xFvrt+Ry4idlEjLCSqzylN/3B8aLZNqzi1jxc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)