UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uNmBR20haJ8NnadP25uf62GYeNSmy4cm5M+NzIgfX1A=' 
WHERE 
  key_id = '87850fdc5648452ddd9e00657dee7a9b017d72c2065b32ea8a205c66c32cb440' 
  AND (
    token = 'uNmBR20haJ8NnadP25uf62GYeNSmy4cm5M+NzIgfX1A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033