UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6MJT3pSjr4AeTzG6lyOGrmFh2gaaP1nw4J4aIKdxTJY=' 
WHERE 
  key_id = '1d8feacb9d5ba08dd4b05cfb21b9a70904075aa6e8957430a6facc3788987447' 
  AND (
    token = '6MJT3pSjr4AeTzG6lyOGrmFh2gaaP1nw4J4aIKdxTJY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017