UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WGuhscicoaQ+hIi4OLWsLYHA7GQ+1S40j47rwP6n2H0=' 
WHERE 
  key_id = '5b4e9b47d236c2922c055322225582167dda87923975ad9b22254310b9ece366' 
  AND (
    token = 'WGuhscicoaQ+hIi4OLWsLYHA7GQ+1S40j47rwP6n2H0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024