UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eBx3Zr6+j0GiJce/YzmIhplLuGmorpRofTLxENN+z2A=' 
WHERE 
  key_id = '416c091cd38af17a61f07aafe96fcc418f88b009f2eefd96e540c52cd88dcc9c' 
  AND (
    token = 'eBx3Zr6+j0GiJce/YzmIhplLuGmorpRofTLxENN+z2A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034