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