UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JVYu0atjMEGWhUL4R8EzFEi98RG69q/J1t+1gqr7iz0='
WHERE
key_id = 'd34158e92ecc608584bbff3cf623a031548c3903ca4d75bf7da1f23d0459ba24'
AND (
token = 'JVYu0atjMEGWhUL4R8EzFEi98RG69q/J1t+1gqr7iz0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)