UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ivT23J/0SflmN9LxwH0n+Rv2+iBNtJVV3css87594TM='
WHERE
key_id = 'be8bf5b80cf164b9405b7c14dbd51217d3e085f0b3935a99d43bec62f75de706'
AND (
token = 'ivT23J/0SflmN9LxwH0n+Rv2+iBNtJVV3css87594TM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)