UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XBEWE9JNEppMzKtzhP5IvWsr0mv23MKayD3KXH+OAKQ='
WHERE
key_id = 'f6d109cf148cc75122b1d7263c4010c82beef3bcb1709189b765fdab4ac8a5ba'
AND (
token = 'XBEWE9JNEppMzKtzhP5IvWsr0mv23MKayD3KXH+OAKQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)