UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'euxhQBsn7IoiSwzEbtM4EIvglSGS0dubI+6tAFpBzTk='
WHERE
key_id = 'e9c9123fda3c772e6b8e76d17d14591984856547fb26e1a3d6b466c39a4e671e'
AND (
token = 'euxhQBsn7IoiSwzEbtM4EIvglSGS0dubI+6tAFpBzTk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)