UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gp0KpMU2Y2g6x2n0gsdgpT9rUUmGsMwCrH0xPNWjKl4='
WHERE
key_id = '3a369ec60aa3f485549b68d51bd04277fadd6afa2209294eeba4b8ad3c31bafc'
AND (
token = 'gp0KpMU2Y2g6x2n0gsdgpT9rUUmGsMwCrH0xPNWjKl4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)