UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gXDn9ItYhXyhSOo44Eyw1bL8uAxFkcMm5zBG+hnLDQE=' 
WHERE 
  key_id = 'dd042149069a8a59f1f8ad45f464f90d1c09265dd13bfbf6439e472b8f4defa2' 
  AND (
    token = 'gXDn9ItYhXyhSOo44Eyw1bL8uAxFkcMm5zBG+hnLDQE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039