UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JNnt5asZa5i1Yjcntn82oeYULEBYWHhTOM6kkXjdvg8='
WHERE
key_id = 'b03fd9b72f246ca7dbd6a87d4687fd57628609add2361043177fd9029905647e'
AND (
token = 'JNnt5asZa5i1Yjcntn82oeYULEBYWHhTOM6kkXjdvg8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)