UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HNcIVtIeiZqnvu7FZFgeVX0zZQIlBiRBPocPOTDDMpk=' 
WHERE 
  key_id = 'b1a38331732e64f3183170d09ad6919669375838112dc0c4164153e9dcfb13ca' 
  AND (
    token = 'HNcIVtIeiZqnvu7FZFgeVX0zZQIlBiRBPocPOTDDMpk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043