UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mJWOZwHqPAamKrKhF1EKiCv95HXJVi1g5Na9lN+ayQo='
WHERE
key_id = '8af9d871b39f815e692d4cda0bb14ebc4f9160197c6db4a2a9cd7d0374c5837b'
AND (
token = 'mJWOZwHqPAamKrKhF1EKiCv95HXJVi1g5Na9lN+ayQo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)