UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't2do74+j+yDLYVTjc96EUYoREL/k5KftMQ1c+wgyxf8=' 
WHERE 
  key_id = 'b3170606fcfa37488e25ac1d51d5ba4457ed1a81c89b29a6e3cab61ac407a981' 
  AND (
    token = 't2do74+j+yDLYVTjc96EUYoREL/k5KftMQ1c+wgyxf8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036