UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2asYXU+T4r11JUIPtwNNUVyYE+XVI9FNdkHreo1y4RM=' 
WHERE 
  key_id = 'f4b0532d869c5dd680f35aa585e47547d3ca300796d8eff174ebf791710a2b13' 
  AND (
    token = '2asYXU+T4r11JUIPtwNNUVyYE+XVI9FNdkHreo1y4RM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033