UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ktW2JclKj4ggJ625E+OgQP6gQHhkMw9PTmgdTTTy0QU=' 
WHERE 
  key_id = '5b0407254f197d7bb49548dc8fb496964e0c3c9f918e009218c75b3e093ef398' 
  AND (
    token = 'ktW2JclKj4ggJ625E+OgQP6gQHhkMw9PTmgdTTTy0QU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029