UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BpBbZeDVzzq/6PwC1rlbo+3O/K2mjprTR5ZtorQ4Kd0=' 
WHERE 
  key_id = '488ffc201ed09e8fbaa8cfc08916f2606578d35e042cc379ce78054809d538f3' 
  AND (
    token = 'BpBbZeDVzzq/6PwC1rlbo+3O/K2mjprTR5ZtorQ4Kd0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047