UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'To+t2mlxxmEDaEfsquhXOl/EQnBQGwX+pg2U7p7HUtk='
WHERE
key_id = '2a50887bb4ee7039d8e53e2b797fcb09c800f64056b2b66b7dc835ef8688adb0'
AND (
token = 'To+t2mlxxmEDaEfsquhXOl/EQnBQGwX+pg2U7p7HUtk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)