UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HIWOhGPpH38/gtL+anr0NQW0U0Kqtt51y3bEqlV1hP0='
WHERE
key_id = 'd8c397ab657016e2c351be4fdab1ce1a0e5a38ed26c88fb655cd511595c6e60f'
AND (
token = 'HIWOhGPpH38/gtL+anr0NQW0U0Kqtt51y3bEqlV1hP0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)