UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NWy80Nu+GXXA7QlkYRIxFo9UCgwC+zjkD6aFPWP8/JE=' 
WHERE 
  key_id = 'b9fbd15da1532b90234991bce73314579efb0c57db53920811a3599a41a4d034' 
  AND (
    token = 'NWy80Nu+GXXA7QlkYRIxFo9UCgwC+zjkD6aFPWP8/JE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045